home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Frameworks / Extension Shell 1.5 / Sample Extensions (1.5) / Shutdown Fade ƒ / Shutdown.c < prev   
C/C++ Source or Header  |  1995-11-02  |  2KB  |  92 lines

  1. /*    NAME:
  2.         Shutdown.c
  3.  
  4.     WRITTEN BY:
  5.         Dair Grant
  6.                 
  7.     DESCRIPTION:
  8.         This file contains a code resource to be installed as a Shutdown task.
  9.  
  10.     NOTES:
  11.         On shutdown, we fade all the displays to black.
  12.  
  13.     ___________________________________________________________________________
  14. */
  15. //=============================================================================
  16. //        Include files                                                                     
  17. //-----------------------------------------------------------------------------
  18. #include "A4Stuff.h"
  19. #include "SetupA4.h"
  20. #include "Gamma.h"
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. //=============================================================================
  37. //        Private function prototypes                             
  38. //-----------------------------------------------------------------------------
  39. pascal void main(void);
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55. //=============================================================================
  56. //        main : Entry point to our code resource.                                                                 
  57. //-----------------------------------------------------------------------------
  58. //        Note :    We fade all the monitors down to black.
  59. //-----------------------------------------------------------------------------
  60. pascal void main(void)
  61. {    long        oldA4;
  62.     short        n;
  63.     
  64.  
  65.     // Set up A4
  66. #ifndef powerc
  67.     oldA4 = SetCurrentA4();
  68. #endif
  69.     
  70.     
  71.     
  72.     // Initialise the Gamma Tools library, and do nothing if we can't use it
  73.     if (SetupGammaTools() == noErr)
  74.         {
  75.         if (IsGammaAvailable())
  76.             {
  77.             // If it all went OK, fade down slowly
  78.             for (n = 100; n >= 0; n -= 3)
  79.                 DoGammaFade(n); 
  80.  
  81.             DisposeGammaTools();
  82.             }
  83.         }
  84.         
  85.     
  86.  
  87.     // Restore A4 and return
  88. #ifndef powerc
  89.     SetA4(oldA4);
  90. #endif
  91. }
  92.